
local kunshou = fk.CreateSkill {
  name = "lingling__kunshou",
}

Fk:loadTranslationTable{
  ["lingling__kunshou"] = "困兽",
  [":lingling__kunshou"] = "出牌阶段，你可以将【桃】当【动摇军心】、【酒】当【铁索连环】使用。",

  ["#lingling__kunshou"] = "困兽：将【桃】当【动摇军心】、【酒】当【铁索连环】使用",
  ["#lingling__kunshou-peach"] = "困兽：将【桃】当【动摇军心】使用",
  ["#lingling__kunshou-analeptic"] = "困兽：将【酒】当【铁索连环】使用",
}

kunshou:addEffect("viewas", {
  anim_type = "control",
  mute_card = false,
  prompt = function (self, player, selected_cards)
    if #selected_cards == 0 then
      return "#lingling__kunshou"
    else
      return "#lingling__kunshou-"..Fk:getCardById(selected_cards[1]).trueName
    end
  end,
  handly_pile = true,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and table.contains({"peach", "analeptic"}, Fk:getCardById(to_select).trueName)
  end,
  view_as = function(self, player, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("ling__waver_morale")
    if Fk:getCardById(cards[1]).trueName == "analeptic" then
      card = Fk:cloneCard("iron_chain")
    end
    card.skillName = kunshou.name
    card:addSubcard(cards[1])
    return card
  end,
})

kunshou:addAI(nil, "vs_skill")

return kunshou
